package com.ldcc.report_system.util.http;

/**
 * @param <T> 通配符
 * @author wwj[yeshengkele@outlool.com]
 * @description 服务器消息返回体封装
 */
public class ServerResponse<T> {
    /**
     * 成功的code
     */
    private static int SUCCESS_CODE = 0;
    /**
     * 响应码
     */
    private int code;
    /**
     * 提示信息
     */
    private String msg;
    /***
     * 返回的具体数据
     */
    private T data;

    public boolean isSuccess() {
        return getCode() == SUCCESS_CODE;
    }

    public static int getSuccessCode() {
        return SUCCESS_CODE;
    }

    public static void setSuccessCode(int successCode) {
        SUCCESS_CODE = successCode;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }


    @Override
    public String toString() {
        return "ResponseEntity{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
